namespace Cooking.Client.ViewModels.Coroutines
{
    /// <summary>
    /// Factory class for various types of coroutines
    /// </summary>
    public static class Routines
    {
        private static EnsureRecipeTitleUniquenessCoroutine uniquenessCoroutine = null;

        public static EnsureRecipeTitleUniquenessCoroutine EnsureRecipeTitleUniqueness(string recipeTitle)
        {
            if (uniquenessCoroutine != null)
            {
                uniquenessCoroutine.Cancel();
            }
            
            uniquenessCoroutine = new EnsureRecipeTitleUniquenessCoroutine(recipeTitle);

            return uniquenessCoroutine;
        }
    }
}